<?php

namespace App\model;

use Illuminate\Database\Eloquent\Model;

/**
 * App\WorkshopIndustry
 *
 * @property int $id
 * @property string|null $name 厂房行业
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\WorkshopIndustry whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\WorkshopIndustry whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\WorkshopIndustry whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\WorkshopIndustry whereUpdatedAt($value)
 * @mixin \Eloquent
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\WorkshopIndustry newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\WorkshopIndustry newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\WorkshopIndustry query()
 */
class WorkshopIndustry extends Model
{
    //
    protected $table="workshop_industry";
    public static function getSelectOptions()
    {
        $options = \DB::table('workshop_industry')->select('id','name as text')->get();
        $selectOption = [];
        foreach ($options as $option){
            $selectOption[$option->id] = $option->text;
        }
        return $selectOption;
    }

    public static function getSelectOption($value)
    {
        $options = \DB::table('workshop_industry')->whereIn('id',$value)->select('id','name as text')->get();
        $selectOption = null;
        foreach ($options as $option){
            $selectOption = $selectOption.'、'.$option->text;
        }
        return ltrim($selectOption,"、");
    }
}
